package com.example.business.controller.base;

import com.example.business.request.ProductListRequest;
import com.example.business.response.ProductResponse;
import com.example.business.service.ProductService;
import com.example.common.response.PageResponse;
import com.example.common.response.R;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;

@Component
public class ProductBaseController {
    @Autowired
    public ProductService productService;

    @GetMapping("list")
    public R<PageResponse<ProductResponse>> list(@Valid ProductListRequest request) {
        PageResponse<ProductResponse> list = productService.list(request);
        return R.ok(list);
    }
}
